
import {
  getEmployeeInfo,
} from '@/services'

export default {
  namespace: 'index',
  state: {
    flag: true,
    baseUser: {},
    workHour: {},
    weekly: {},
    approval: {},
    travel: {},
    teamBuilding: {},
    shackleton: {},
  },
  effects: {
    *getEmployeeInfo({ payload }, { call, put }) {
      const response = yield call(getEmployeeInfo, payload)
      yield put({
        type: 'getInfo',
        payload: response,
      });
    }
  },


  reducers: {
    getInfo(state, { payload }) {
      return {
        ...state,
        flag: false,
        // ...payload,
        baseUser: payload.baseUser,
        workHour: payload.workHour,
        weekly: payload.weekly,
        approval: payload.approval,
        travel: payload.travel,
        teamBuilding: payload.teamBuilding,
        shackleton: payload.shackleton,
      }
    },
  },
};
